package com.hackerrank.challenges.programminglanguagedetection;

import java.util.Scanner;

public class Solution {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String code = "";
		while(in.hasNext())
			code += in.nextLine() + "\n";
		String mlComment = "/\\*([^*]|[\\r\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+/", slComment = "//[^\\r\\n]*";
		String uncommentedCode = code.replaceAll(slComment, "").replaceAll(mlComment, "");
		String ssCode = uncommentedCode.replaceAll("\\s+", " ");
		// match for C
		String include = "#include<[a-z]+.h>", includeBlock = include + "( " + include + ")*";
		String variable = "[a-zA-Z_][a-zA-Z_0-9]*", value = "[0-9]+";
		String define = "#define " + variable + " " + value, defineBlock = "(" + define + ")?( " + define + ")*";
		if(ssCode.matches(" ?" + includeBlock + defineBlock + ".*")) {
			System.out.println("C");
			return;
		}
		// match for java
		String jPackage = "(" + variable + "\\.)+(\\*|(" + variable + "))";
		String jImport = "import " + jPackage + " ?;", importBlock = "(" + jImport + ")?( ?" + jImport + ")*";
		String jClass = "(public|abstract|final)?( (public|abstract|final))* ?class " + variable + " ?\\{.*\\}";
		String classBlock = jClass + "( ?" + jClass + ")*";
		if(ssCode.matches(" ?" + importBlock + " ?" + classBlock + " ?")) {
			System.out.println("Java");
			return;
		}
		System.out.println("Python");
	}
}
